from django.conf import settings
import jwt


class MJwt():
    def __init__(self):
        self.secret = settings.SECRET_KEY

    # 加密
    def jwt_encode(self, data):
        return jwt.encode(data, self.secret, algorithm="HS256")

    # 解密
    def jwt_decode(self, token):
        return jwt.decode(token, self.secret, algorithms="HS256")


mjwt = MJwt()
